/**
 * Created by caosh on 2018/5/11 0011.
 */
var surveyIndex = new Vue({
    el: '#survey-index'
    , data: {
        today: {
            day: '',
            month: '',
            weekday: ''
        },
        aptPending: {
            'nearRent': 0,
            'overdue': 0,
            'nearExpire': 0
        },
        user: {},
        rentals: {
            newRent: 16,
            refundRent: 3,
            hasRent: 150,
            empty: 150,
            emptyPercent: '25.00%'
        },
        income: {
            rent: 5000.00,
            deposit: 10000.00,
            otherFees: 3545.00,
            refund: 100.00
        }
    }
    , methods: {
        getAptPending: function () {
            var _this = this;
            this.setRequestDatas(null);
            this.ajaxOptions.url = '/getAptPending';
            this.ajaxOptions.done = function (result, status, jqXHR) {
                if (result.retCode == 0) {
                    _this.aptPending = result.data;
                }
            };
            this.doAjax();
        },
        getToday: function () {
            moment.locale('zh-CN');
            this.today.weekday = moment().format('dddd');
            this.today.month = moment().format('M月YYYY年');
            this.today.day = moment().format('D');
        }
    }
    , mixins: [AjaxMixin, UserMixin]
    , mounted: function () {
        Vue.useLayerElement();

        this.getToday();
        this.getAptPending();

        this.user = Vue.getStore('user');
    }
});
